package com.bw.mallshop.mvvm.model;


import com.bw.common.entity.BaseEntity;
import com.bw.common.mvvm.model.BaseModel;
import com.bw.common.network.HttpType;
import com.bw.common.network.RetrofitFactory;
import com.bw.mallshop.repository.ApiService;

import java.util.Map;

import io.reactivex.Observable;

public class ShipAddressModel extends BaseModel {

    //添加
    public Observable<BaseEntity>requestAddAddress(Map<String,Object>map){
        return changeObservable(RetrofitFactory.factory(HttpType.TOKEN)
                .createRetrofit().create(ApiService.class)
                .requestAddAddress(createBody(map)));
    }

    //列表
    public Observable<BaseEntity>requestAddressList(Map<String,Object>map){
        return changeObservable(RetrofitFactory.factory(HttpType.TOKENSIGN)
                .createRetrofit().create(ApiService.class)
                .requestAddressList(createBody(map)));
    }

    //修改
    public Observable<BaseEntity>requestUpdateAddress(Map<String,Object>map){
        return changeObservable(RetrofitFactory.factory(HttpType.TOKEN)
                .createRetrofit().create(ApiService.class)
                .requestUpdateAddress(createBody(map)));
    }

    //删除
    public Observable<BaseEntity>requestDelAddress(Map<String,Object>map){
        return changeObservable(RetrofitFactory.factory(HttpType.TOKENSIGN)
                .createRetrofit().create(ApiService.class)
                .requestDelAddress(createBody(map)));
    }

}
